#对比两个文件夹
import os
import shutil
import tqdm


save_path =r'AprilTag/obj_000000/'
source_dir = r'AprilTag/results/axes/'
pose_dir =r'AprilTag/results/poses/'

rgb_dir =os.path.join(save_path, 'rgb')
pose_dir_save =os.path.join(save_path, 'pose')

def copy_good(dir):
    for iter,filenanme in tqdm.tqdm(enumerate(os.listdir(source_dir))):
        filenanme = filenanme.split('_')[-1]
        shutil.copy(os.path.join(dir,filenanme),os.path.join(rgb_dir,f'{iter}.jpg'))

        pose_path=os.path.join(pose_dir,filenanme.replace('jpg','txt'))

        shutil.copy(pose_path,os.path.join(pose_dir_save,f'{iter}.txt'))


if __name__ == '__main__':
    copy_good(r'AprilTag/img/aruco')